package com.example.milimili;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

public class MyFragment extends Fragment {
    private Button collectBtn,historyBtn,cleanBtn;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.mylayout,container,false);
        collectBtn=view.findViewById(R.id.collect);
        historyBtn=view.findViewById(R.id.history);
        cleanBtn=view.findViewById(R.id.clean);
        collectBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=new Intent(getContext(),CollectActivity.class);
                getContext().startActivity(intent);
            }
        });
        historyBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=new Intent(getContext(),HistoryActivity.class);
                getContext().startActivity(intent);
            }
        });
        cleanBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                MySQLiteOpenHelper mySQLiteOpenHelper=new MySQLiteOpenHelper(getContext());
                mySQLiteOpenHelper.deleteAll();
            }
        });
        return view;
    }

}
